package com.hkbigdata.springbootdi.controller;

import com.alibaba.fastjson.JSONObject;
import com.hkbigdata.springbootdi.bean.ResponData;
import com.hkbigdata.springbootdi.service.DiService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuanbo
 * @creat 2024-12-09-9:52
 * @see 2194550857@qq.com
 */
@RestController
public class DiController {

    @Autowired
    DiService diService;

    //1.
    @RequestMapping("/queryOrderStatus")
    public Object queryOrderStatus(String dt) {
        ResponData responData = diService.queryOrderStatus(dt);
        if (StringUtils.isNotBlank(dt)) {
            return responData;
        } else {
            return "数据有问题";
        }
    }

    //2.
    @RequestMapping("/queryBrandScore")
    public Object queryBrandScore() {
        return diService.queryBrandScore();
    }

    //3.
    @RequestMapping("/queryCkBrandSale")
    public Object queryCkBrandSale() {
        return diService.queryCkSales();
    }

    //4
    @RequestMapping("/queryCkBrandSaleTotal")
    public Object queryCkBrandSaleTotal() {
        return diService.queryCkSalesTotal();
    }

    //5
    @RequestMapping("/queryEsSourceTotal")
    public Object queryEsSourceTotal() {
        return diService.queryEsSource();
    }

    //6.
    @RequestMapping("/queryEsProfeesionSex")
    public Object queryEsProfeesionSex() {
        return diService.queryEsProfeesionSex();
    }

    //7
    @RequestMapping("/queryCkProvinceSales")
    public Object queryCkProvinceSales(String province) {
        return diService.queryCkProvinceSales(province);
    }

    //8
    @RequestMapping("/queryCkProvinceOrderAndSales")
    public Object queryCkProvinceOrderAndSales() {
        return diService.queryCkProvinceOrderAndSales();
    }

    //9
    @RequestMapping("/app")
    public Object queryCkBrandSales(String logStr) {
        diService.pushLogToKafka(logStr);
        return "ok";
    }


}
